import Vue from 'vue'
import VueRouter from 'vue-router'
import Logon from '@/views/login/Logon.vue'
import LayoutView from '../views/Layout/layout.vue'
import HomeIndex from '@/views/home/index.vue'
import XtxCartPage from '@/views/User/index.vue'
import AdminUser from '@/views/admin/search.vue'
import UserCard from '@/views/userscar/index.vue'
import PersonCard from '@/views/person/index.vue'
import DataManagement from '@/views/data/data.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'HomeView',
    component: Logon
  },

  {
    path: '/',
    name: 'LayoutView',
    component: LayoutView,
    children: [
      {
        path: '', // 路由置空的时候会作为一级路由默认渲染的二级路由
        component: HomeIndex
      },
      {
        path: '/user', // 路由置空的时候会作为一级路由默认渲染的二级路由
        component: XtxCartPage
      },
      {
        path: '/admin', // 路由置空的时候会作为一级路由默认渲染的二级路由
        component: AdminUser
      },
      {
        path: '/usercard', // 路由置空的时候会作为一级路由默认渲染的二级路由PersonCard
        component: UserCard
      },
      {
        path: '/person', 
        component: PersonCard
      },
      {
        path: '/data', 
        component: DataManagement
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
